package com.athena.dal.entities;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Date;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * The persistent class for the faculty database table.
 * 
 */
@Entity
@Table(name = "faculty")
@PrimaryKeyJoinColumn(name = "id")
@NamedQuery(name = "Faculty.findByDepartmentId", query = "SELECT f FROM Faculty f WHERE LOWER(f.department.id) = LOWER(:departmentId)")
public class Faculty extends User implements Serializable {
	private static final long serialVersionUID = 1L;

	@Column(length = 128)
	private String degree;

	@Column(length = 128)
	private String designation;

	@Temporal(TemporalType.DATE)
	@Column(nullable = false)
	private Date joiningDate;

	@Column(length = 256)
	private String major;

	@Column(nullable = false)
	private Timestamp updatedAt;

	// bi-directional many-to-one association to routine_rules
	@OneToMany(mappedBy = "faculty")
	private Set<RoutineRules> routineRules;

	// bi-directional many-to-one association to Class
	@OneToOne(mappedBy = "classTeacher")
	private Class clazz;

	// bi-directional many-to-one association to Department
	@OneToMany(mappedBy = "hod")
	private Set<Department> departments;

	// bi-directional many-to-one association to ExaminationInvigilation
	@OneToMany(mappedBy = "faculty")
	private Set<ExaminationInvigilation> examinationInvigilations;

	// bi-directional many-to-one association to Department
	@ManyToOne
	@JoinColumn(name = "departmentId", nullable = false)
	private Department department;

	// bi-directional many-to-one association to Teach
	@OneToMany(mappedBy = "faculty")
	private Set<Teach> teaches;

	// bi-directional many-to-one association to Teach
	@OneToMany(mappedBy = "faculty")
	private Set<RoutineInstance> routineInstance;

	public Faculty() {
	}

	public String getDegree() {
		return this.degree;
	}

	public void setDegree(String degree) {
		this.degree = degree;
	}

	public String getDesignation() {
		return this.designation;
	}

	public void setDesignation(String designation) {
		this.designation = designation;
	}

	public Date getJoiningDate() {
		return this.joiningDate;
	}

	public void setJoiningDate(Date joiningDate) {
		this.joiningDate = joiningDate;
	}

	public String getMajor() {
		return this.major;
	}

	public void setMajor(String major) {
		this.major = major;
	}

	public Timestamp getUpdatedAt() {
		return this.updatedAt;
	}

	public void setUpdatedAt(Timestamp updatedAt) {
		this.updatedAt = updatedAt;
	}

	public Set<RoutineRules> getRoutineRules() {
		return routineRules;
	}

	public void setRoutineRules(Set<RoutineRules> routineRules) {
		this.routineRules = routineRules;
	}

	public Set<RoutineInstance> getRoutineInstance() {
		return routineInstance;
	}

	public void setRoutineInstance(Set<RoutineInstance> routineInstance) {
		this.routineInstance = routineInstance;
	}

	public Class getClazzs() {
		return this.clazz;
	}

	public void setClazzs(Class clazz) {
		this.clazz = clazz;
	}

	public Set<Department> getDepartments() {
		return this.departments;
	}

	public void setDepartments(Set<Department> departments) {
		this.departments = departments;
	}

	public Set<ExaminationInvigilation> getExaminationInvigilations() {
		return this.examinationInvigilations;
	}

	public void setExaminationInvigilations(
			Set<ExaminationInvigilation> examinationInvigilations) {
		this.examinationInvigilations = examinationInvigilations;
	}

	public Department getDepartment() {
		return this.department;
	}

	public void setDepartment(Department department) {
		this.department = department;
	}

	public Set<Teach> getTeaches() {
		return this.teaches;
	}

	public void setTeaches(Set<Teach> teaches) {
		this.teaches = teaches;
	}

}